package eo.builder.exception;

/**
 * Exception that contains a message bundle code and arguments to display
 * properly.
 * 
 * @author takeshi
 * 
 */
public class MessageCodeException extends Exception {

    private static final long serialVersionUID = 6088075547520852969L;

    private final String messageCode, defaultText;
    private final Object[] args;

    /**
     * 
     * @param messageCode
     *            the error message code, to be used as a message bundle key
     * @param defaultText
     *            the default text, in case the key is not found
     * @param args
     *            the arguments
     */
    public MessageCodeException(String messageCode, String defaultText,
            Object... args) {
        super();
        this.messageCode = messageCode;
        this.defaultText = defaultText;
        this.args = args;
    }

    /**
     * 
     * @param messageCode
     *            the message code
     */
    public MessageCodeException(final String messageCode) {
        this(messageCode, null);
    }

    /**
     * @return the messageCode
     */
    public String getMessageCode() {
        return messageCode;
    }

    /**
     * @return the defaultText
     */
    public String getDefaultText() {
        return defaultText;
    }

    /**
     * @return the args
     */
    public Object[] getArgs() {
        return args;
    }

}
